package br.com.caelum.vraptor.blank;


import org.apache.commons.mail.Email;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;

import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.simplemail.Mailer;

@Resource
public class EmailController {
	
	
	private final Mailer mailer;
	
	public EmailController(Mailer mailer){
		this.mailer = mailer;		
	}
	
    @Path("/email/send")    
    public void sendNewPassword() throws EmailException {
    	
        Email email = new SimpleEmail();
        email.setSubject("Your new password");
        email.addTo("desenvolvimento@mundolivre.com.br");
        email.setMsg("Teste de email");
        mailer.send(email); // Hostname, port and security settings are made by the Mailer
    }

}
